import java.io.*; 
import java.net.*; 

class ClientUDP_TP1 { 
    public static void main(String args[]) throws Exception { 
	
	BufferedReader entreeDepuisUtilisateur = new BufferedReader(new InputStreamReader(System.in)); 
	
	DatagramSocket socketClient = new DatagramSocket(); 
	
	InetAddress AdresseIP = InetAddress.getByName("localhost"); 
	
	byte[] donneeEnvoyee = new byte[1024]; 
	byte[] donneeRecue = new byte[1024]; 
	
	String phrase = entreeDepuisUtilisateur.readLine(); 

	donneeEnvoyee = phrase.getBytes();
	

	DatagramPacket sendPacket = new DatagramPacket(donneeEnvoyee, donneeEnvoyee.length, AdresseIP, 4567); 
	
	socketClient.send(sendPacket); 
	
	DatagramPacket receivePacket = 
	    new DatagramPacket(donneeRecue, donneeRecue.length); 
	
	socketClient.receive(receivePacket); 
	
	String modifiedSentence = 
	    new String(donneeRecue); 
	
	System.out.println("FROM SERVER:" + modifiedSentence); 
	socketClient.close(); 
    } 
} 
